package _01Math类;

public class Demo {
    public static void main(String[] args) {

        //向上取整ceil()和向下取整floor()
        double a = 5.20;

        System.out.println(Math.ceil(a));//向上取整   5
        System.out.println(Math.floor(a));//向下取整  6


        //取绝对值abs()
        int b = -10;
        System.out.println(Math.abs(b));

        //四舍五入round()，接收小数，得到整数，看十分位（小数点后第一位）
        System.out.println(Math.round(3.49));//3
        System.out.println(Math.round(4.51));//5

        //public  static double pow(double a,double b) : 计算a的b次方
        System.out.println(Math.pow(2, 3)); //计算2的3次方，幂  8.0
        System.out.println(Math.pow(2, 10)); //计算2的10次方，幂  1024.0

        //获取最大值
        System.out.println(Math.max(10, 20));
    }
}
